package com.xx.track_log.log;

import org.apache.log4j.AppenderSkeleton;
import org.apache.log4j.spi.LoggingEvent;

/**
 * @author fanjj
 * @date 2017/10/19
 */
public class TrackAppender extends AppenderSkeleton {
    private String logFolder;
    private String logLevel;

    @Override
    protected void append(LoggingEvent event) {
        TrackLogger.getInstance().process(event, getLayout());
    }

    @Override
    public void close() {
    }

    @Override
    public boolean requiresLayout() {
        return true;
    }

    public String getLogFolder() {
        return logFolder;
    }

    public void setLogFolder(final String logFolder) {
        //初始化的时候将logFolder赋值
        TrackLogger.getInstance().setLogFolder(logFolder);
        this.logFolder = logFolder;
    }

    public String getLogLevel() {
        return logLevel;
    }

    public void setLogLevel(String logLevel) {
        //初始化的时候将logFolder赋值
        TrackLogger.getInstance().setLogLevel(logLevel);
        this.logLevel = logLevel;
    }
}
